import { Component, OnInit } from '@angular/core';
declare var $: any;

//Http 类
import { Http } from '@angular/http';
//可以把http请求转化成promise
import 'rxjs/add/operator/toPromise'

@Component({
  selector: 'app-tian',
  templateUrl: './tian.component.html',
  styleUrls: ['./tian.component.css']
})
export class TianComponent implements OnInit {
  result={};

  constructor(private http: Http) { }
  onClick(result,event) {
    console.log(result)
    console.log(event)
    //发请求 
    $.post('http://192.168.40.205/h25/api/add.php', result)
        .done((res) => {
        	console.log(res)
        	alert(res.message)
          location.href = "list"
        })
  }
  
  ngOnInit() {


  }

}
